package com.eazy.lkv2.core.web.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.eazy.lkv2.core.web.utils.IPUtil;
import com.eazy.lkv2.web.entity.SystemLog;

import eu.bitwalker.useragentutils.UserAgent;

public class SystemLogInterceptor extends BaseInterceptor {

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
		UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent")); 
		String os=userAgent.getOperatingSystem().getName();	//获取客户端操作系统
		String browser=userAgent.getBrowser().getName();	//获取客户端浏览器
		
		SystemLog log=new SystemLog();
		log.setOs(os);
		log.setBrowser(browser);
		log.setIp(IPUtil.getIpAddress(request));
		//log.setCreateDate(DateUtils.getSysTimestamp());
	}
}
